/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once


#include "../core/DX头.h"


typedef struct {
	ID3D12Device4*				设备;
	ID3D12CommandQueue*			命令列队;
	ID3D12GraphicsCommandList*	命令列表;
}S_DX环境;





inline D3D12_HEAP_PROPERTIES f_缓存性能设置参数(
	D3D12_HEAP_TYPE type=D3D12_HEAP_TYPE_DEFAULT,
	UINT creationNodeMask=1,
	UINT nodeMask = 1
) {
	D3D12_HEAP_PROPERTIES properties;
	properties.Type = type;
	properties.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
	properties.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
	properties.CreationNodeMask = 1;
	properties.VisibleNodeMask = 1;
	return properties;
}






inline D3D12_RESOURCE_DESC f_D3D12_RESOURCE_DESC(
	D3D12_RESOURCE_DIMENSION dimension,
	UINT64 alignment,
	UINT64 width,
	UINT height,
	UINT16 depthOrArraySize,
	UINT16 mipLevels,
	DXGI_FORMAT format,
	UINT sampleCount,
	UINT sampleQuality,
	D3D12_TEXTURE_LAYOUT layout,
	D3D12_RESOURCE_FLAGS flags

) {
	D3D12_RESOURCE_DESC GPU资源 = {};


	GPU资源.Alignment = alignment;
	GPU资源.Width = width;
	GPU资源.Height = height;
	GPU资源.DepthOrArraySize = depthOrArraySize;
	GPU资源.MipLevels = mipLevels;
	GPU资源.Format = format;
	GPU资源.SampleDesc.Count = sampleCount;
	GPU资源.SampleDesc.Quality = sampleQuality;
	GPU资源.Layout = layout;
	GPU资源.Flags = flags;


	return GPU资源;
}


inline D3D12_RESOURCE_DESC f_DX_1D缓存参数数组(uint64 length, D3D12_RESOURCE_FLAGS flags=D3D12_RESOURCE_FLAG_NONE, UINT64 alignment = 0) {
	return f_D3D12_RESOURCE_DESC(
		D3D12_RESOURCE_DIMENSION_BUFFER,
		alignment,
		length,
		1,
		1,
		1,
		DXGI_FORMAT_UNKNOWN,
		1,
		0,
		D3D12_TEXTURE_LAYOUT_ROW_MAJOR,
		flags
		);
}




